#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
	unsigned int a,b;
	char op;
	while(scanf("%u %c %u",&a,&op,&b)!=EOF)
	{
		unsigned int c;
		int num=0;
		if(op=='&')
		{
			c=a&b;
		}
		
		else if(op=='|')
		{
			c=a|b;
		}
		
		else
		{
			c=a^b;
		}
		
		for(int i = 31 ; i >= 0 ;i--)
		{
			int d=(c>>i)&1;
			if(d==1)
				num++;
		}
		
		printf("%u %d\n",c,num);
	}
	return 0;
}